﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using SWDataDB.BLL;
public partial class YXExcelReader : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }



    protected void btnSave_Click(object sender, EventArgs e)
    {
        string ZL_FILE_ID = Request.Form["ZL_FILE_ID"].ToString();
        string DataType = Request.Form["DataType"].ToString();
        string ZK_CODE = Request.Form["ZK_CODE"].ToString();
        //设置信息文本保存的文件名(文件名采用当前时间)
        string strDateTime = DateTime.Now.ToString("yyMMddHHMMss");
        //获取上传图片扩展名

        //获得上传文件名称
        string strFileName = fuImage.FileName;
        string FileName = "Loaded_" + strFileName; //设置上传图片名称
        //string extension = Path.GetExtension(fuImage.PostedFile.FileName);
       // string imageName = strDateTime + strFileName; //设置上传图片名称
        //设置图片存放路径
        string strUpPath = Server.MapPath("../../实物地质数据/" + DataType + "/" + ZL_FILE_ID + " 矿产勘查/钻孔/" + ZK_CODE + "/") + FileName;
        try
        {



            if (File.Exists(strUpPath))
            {
                Response.Write("<script language=javascript>alert('文件已经读取存在！');history.go(-1);</script>");
            }
            else
            {
                fuImage.SaveAs(strUpPath);//上传图片

                KCInfoEntry ke = new KCInfoEntry();
                string path;
                //path = @"F:\C#\SWDataDB\SWDataDB\SWDataDB.UI\实物地质数据\矿产勘查\000016 矿产勘查\钻孔\ZK2-1\127辽宁抚顺红透山铜锌矿ZK2-1.xls";

                path = strUpPath;
                int i = ke.ZKImgInfoAppend(path);
            }
        }
        catch (Exception ee)
        {
            Response.Write("<script language=javascript>alert('" + ee.ToString() + "');history.go(-1);</script>");
        }
    }


}